package com.demo.my_util.datasource;


import com.demo.my_util.ServerConfig;
import com.jfinal.kit.Prop;
import com.jfinal.plugin.druid.DruidPlugin;

import javax.sql.DataSource;

/**
 * @author: 李德才
 * @description:
 * @create: 2021-04-17 22:13
 **/
public class PublicDataSource {


    public static DataSource getDataSource() {
        Prop prop = ServerConfig.loadConfig();
        DruidPlugin druidPlugin = new DruidPlugin(prop.get("jdbc.url"), prop.get("jdbc.username"), prop.get("jdbc.password"),prop.get("jdbc.driver"));
        druidPlugin.start();
        return druidPlugin.getDataSource();
    }
}
